//
//  AppDelegate+DTCRootController.m
//  BluetoothProject
//
//  Created by JianWei Chen on 16/9/5.
//  Copyright © 2016年 JianWei Chen. All rights reserved.
//

#import "AppDelegate+DTCRootController.h"
#import "LoginViewController.h"
#import "HomeListViewController.h"
#import "FLSideSlipViewController.h"
#import "LeftMenuViewController.h"
#import "BaseNavigationController.h"
@interface AppDelegate ()

@end



@implementation AppDelegate (DTCRootController)

- (void)setRootViewController
{
    
    if (EXRACT_BOOL(LOGIN) == NO) {
        UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
        LoginViewController *loginVC = [mainStoryboard instantiateViewControllerWithIdentifier:@"LoginViewController"];
        UINavigationController * navLogin = [[UINavigationController alloc] initWithRootViewController:loginVC];
        self.window.rootViewController = navLogin;
    }else{
        [self showMainVC];
    }

}


- (void)showMainVC
{

    
    HomeListViewController *controller = [HomeListViewController new];
    UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:controller];
    self.menuViewController = [[FLSideSlipViewController alloc]initWithRootViewController:nav];
    self.menuViewController.animationType = AnimationTransition;
    
    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];

    LeftMenuViewController *leftController = [mainStoryboard instantiateViewControllerWithIdentifier:@"LeftMenuViewController"];
    self.menuViewController.leftViewController = leftController;
    self.menuViewController.canSlideInPush = NO;
    
    self.window.rootViewController = self.menuViewController;
    
    [self.window makeKeyAndVisible];
    
    
}

@end
